package cn.myblog.ainblog.conroller;

import cn.myblog.ainblog.dto.UserDTO;
import cn.myblog.ainblog.model.UserModel;
import cn.myblog.ainblog.service.UserService;
import org.apache.catalina.User;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import java.util.List;

/**
 * @author Dovaior
 * @Description 作者页面
 * @create 2021-04-02 16:17
 **/
@Controller
public class AuthorController {
    @Autowired
    private UserService userService;

    @GetMapping("/author_about")
    public String pageAbout(Model model){
        //查询全部user列表
        List<UserModel> userModels = userService.queryUserList();
        //取列表中的第0个元素，因为是单用户，所以只有一个用户实体被查询
        model.addAttribute("userModel",userModels.get(0));
        return "author-about";
    }
}
